﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

/*

C:\Users\gb\Music\Against Me!\Acoustic EP\06 Untitled.mp3
C:\Users\gb\Videos\Top Gun.avi
C:\Users\gb\Videos\Archer\Archer.S01E01.avi

*/



namespace Mixr
{
    public partial class MediaPlayground : Form
    {
        bool playing = false;
        bool songLoaded = false;
        int playlistDummy = 1;
        public MediaPlayground()
        {
            InitializeComponent();
        }

        private void playButton_Click(object sender, EventArgs e)
        {
            if (songLoaded == false && playing == false)
            {
                playButton.Text = "Pause";
                axVLC.playlist.items.clear();
                playlistDummy = axVLC.playlist.add(fileLocation.Text);
                axVLC.playlist.playItem(playlistDummy);
                songLoaded = true;
                playing = true;
                return;
            }
            if (songLoaded == true && playing == true)
            {
                playButton.Text = "Play";
                axVLC.playlist.togglePause();
                playing = false;
                return;
            }
            if (songLoaded == true && playing == false)
            {
                playButton.Text = "Pause";
                axVLC.playlist.togglePause();
                playing = true;
                return;
            }
        }

        private void stopButton_Click(object sender, EventArgs e)
        {
            playButton.Text = "Play";
            axVLC.playlist.stop();
            playing = false;
            songLoaded = false;
        }

        private void nextButton_Click(object sender, EventArgs e)
        {
            playButton.Text = "Pause";
            axVLC.playlist.stop();
            volumeLabel.Text = axVLC.playlist.items.count.ToString();
            axVLC.playlist.items.remove(playlistDummy);
            while (axVLC.playlist.items.count > 0) 
            {
                volumeLabel.Text = axVLC.playlist.items.count.ToString();
            }
            playlistDummy = axVLC.playlist.add(nextLocation.Text);
            axVLC.playlist.playItem(playlistDummy);
            songLoaded = true;
            playing = true;
            return;
        }

        private void volumeSelect_Scroll(object sender, EventArgs e)
        {
            int volume = volumeSelect.Value * 10;
            axVLC.Volume = volume;
        }
    }
}
